package event

import (
	"context"
	"ez/apps/wms/auto/mc"
	wms "ez/apps/wms/document"
	"fmt"
	"gitee.com/dreamwood/ez-go/ez"
)

func init() {
	ez.Subscribe(mc.SummaryEventAfterSave, func(v interface{}, ctx context.Context) {
		md, ok := v.(*wms.Summary)
		if ok {
			md.LoadItem()
			md.ItemName = fmt.Sprintf("%s_%s", md.Item.Text, md.Item.Code)
			md.SetEvent(false)
			_ = md.Save()
		}
	})
}
